
package com.ctl.config;

import com.ctl.client.NettyClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.concurrent.ExecutionException;

@Slf4j
@Component
public class ClientConfig {

    @Autowired
    @Qualifier("serviceExecutor")
    public ThreadPoolTaskExecutor threadPoolTaskExecutor;
    @Autowired
    private NettyClient nettyClient;
    @Autowired
    private ServerConfig serverConfig;

//    @PostConstruct
//    public void init() {
//        log.info(" nettyServer is start={}:{}", serverConfig.hostname, serverConfig.port);
//        for (int i = 0; i < 1000; i++) {
//            log.info("start client i={}", i);
//            threadPoolTaskExecutor.submit(() -> nettyClient.start());
//        }
//    }
}
